{% load i18n %}
{% load crispy_forms_field %}

<span class="editable-handler" data-field="{{field.name}}">
  <a title="{{title}}"><i class="icon-edit"></i></a>
  <div class="popover editable">
    <div class="arrow"></div>
    <div class="popover-inner">
      <h3 class="popover-title">
        <button class="close" data-dismiss="clickover">&times;</button>
        {{title}}
      </h3>
      <div class="popover-content">
        <form method="post" action="{{action}}">
          <div class="control-group">
            {% if field|css_class == "checkboxselectmultiple" %}
                {% include 'bootstrap/layout/checkboxselectmultiple.html' %}
            {% endif %} 

            {% if field|css_class == "radioselect" %}
                {% include 'bootstrap/layout/radioselect.html' %}
            {% endif %}

            {% if field|css_class != "checkboxselectmultiple" and field|css_class != "radioselect" %}
                <div class="controls">
                    {% if field|is_checkbox %}
                        <label for="{{ field.id_for_label }}" class="checkbox {% if field.field.required %}requiredField{% endif %}">
                            {% crispy_field field %}
                            {{ field.label|safe }}
                            {% include 'bootstrap/layout/help_text_and_errors.html' %}
                        </label>
                    {% else %}
                        {% crispy_field field %}
                        {% include 'bootstrap/layout/help_text_and_errors.html' %}
                    {% endif %}
                </div>
            {% endif %}
          </div>
          <button type="submit" class="btn btn-primary btn-block">{% trans "Apply" %}</button>
        </form>
      </div>
    </div>
  </div>
</span>